<template>
  <div >
    <div class="shezhi" style=" background-image: url(./img/beijing_01.jpg);">
        <div class="shezhi1">
            <van-nav-bar title="登录" left-text="返回"  left-arrow @click-left="onClickLeft"  class="shezhitu-1" background="transparent"/>
        </div>
        <div class="shezhi2">
            <van-form @submit="onSubmit">
              <van-field
                v-model="username"
                name="用户名"
                label="用户名"
                placeholder="用户名"
                :rules="[{ required: true, message: '请填写用户名' }]"
              />
              <van-field
                v-model="password"
                type="password"
                name="密码"
                label="密码"
                placeholder="密码"
                :rules="[{ required: true, message: '请填写密码' }]"
              />
              <van-checkbox v-model="checked">请勾选同意协议</van-checkbox>
              <div style="margin: 0.16rem;">
                <van-button round block type="info" native-type="submit" :disabled="!checked">登录</van-button>
              </div>
            </van-form>
        </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: '',
      password: '',
       checked: false,
    };
  },
  methods: {
    onSubmit(values) {
      console.log('submit', values);
      alert("登陆成功两秒后跳转至首页")
      setTimeout(() => {
        this.$router.push("/zixun")
      }, 2000);
      
    },
    onClickLeft() {
      this.$router.go(-1)
    },
  },
};
</script>

<style scoped>
.shezhi{
   
    background-repeat: no-repeat;
    background-size: 100%;
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    height: 100%;
}
.shezhi1{
    width: 100%;
}
.shezhi2{
    overflow: auto;
    width: 100%;
    height: 100%;
}
.van-nav-bar{
  background: transparent;
}
</style>